<!DOCTYPE html>
<html lang="en">
  <head>
    <meta content="text/html; charset=iso-8859-15" http-equiv="content-type">
    <title>VC4ASM Expression syntax</title>
    <meta content="Marcel M&uuml;ller" name="author">
    <meta content="Raspberry Pi BCM2835 BCM2836 QPU macro assembler" name="keywords">
    <link rel="stylesheet" href="infstyle.css" type="text/css">
  </head>
  <body>
    <h1>VC4ASM - Expression syntax</h1>
    <p><a href="index.html">&uarr; Top</a>, <a href="#constant">&rarr;
        Constants</a>, <a href="#operator">&rarr; Operators</a></p>
    <h2><a name="constant"></a>Constants</h2>
    <table border="1" cellpadding="3" cellspacing="0">
      <thead>
        <tr>
          <th>Type</th>
          <th>Example</th>
          <th><nobr>Data type</nobr></th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>decimal</td>
          <td><tt>-42</tt></td>
          <td>int<br>
          </td>
          <td>Integer constant, 32 bit signed or unsigned<br>
          </td>
        </tr>
        <tr>
          <td>hexadecimal</td>
          <td><tt>-0xa4</tt></td>
          <td>int<br>
          </td>
          <td>Hexadecimal constant, 32 bit signed or unsigned<br>
          </td>
        </tr>
        <tr>
          <td>octal</td>
          <td><tt>-0377</tt></td>
          <td>int<br>
          </td>
          <td>Octal constant, indicated by leading zero</td>
        </tr>
        <tr>
          <td>binary</td>
          <td><tt>0b10010</tt></td>
          <td>int<br>
          </td>
          <td>Binary constant</td>
        </tr>
        <tr>
          <td>floating point</td>
          <td><tt>1.0<br>
              1.4e6</tt></td>
          <td>float</td>
          <td>Floating point value<br>
            Note that this <i>must</i> include a decimal dot.</td>
        </tr>
        <tr>
          <td>per element constant</td>
          <td><tt>[0,2,3...]</tt></td>
          <td>int2[16]</td>
          <td>2 bit integer per QPU element.</td>
        </tr>
        <tr>
          <td>accumulator<br>
          </td>
          <td><tt>r1</tt></td>
          <td>register</td>
          <td><tt>r0</tt> ... <tt>r5</tt><br>
            On write <tt>r5</tt> need to be named <tt>r5quad</tt> or <tt>r5rep</tt>
            respectively.<br>
          </td>
        </tr>
        <tr>
          <td>memory register</td>
          <td><tt> ra25</tt></td>
          <td>register</td>
          <td><tt>ra0</tt> ... <tt>ra31</tt>, <tt>rb0</tt> ... <tt>rb31</tt>.
            The numbers <tt>r<var>x</var>32</tt> ... <tt>r<var>x</var>63</tt>
            also work, but this is normally not recommended because it prevents
            vc4asm from choosing from any the register file automatically for
            peripheral registers where this does not matter. </td>
        </tr>
        <tr>
          <td>I/O register</td>
          <td><tt>vary<br>
              irq</tt></td>
          <td>register</td>
          <td>Access to peripheral hardware, see <a href="#register">table
              below</a>.</td>
        </tr>
        <tr>
          <td>packed register experssion</td>
          <td><tt>ra0.8csf</tt></td>
          <td>register</td>
          <td>Register that should be packed and/or unpacked. This can be
            assigned to a symbol to define aliases for register slices, e.g.<br>
            <tt>.set back_color, ra0.8ai</tt></td>
        </tr>
        <tr>
          <td>semaphore</td>
          <td><tt>sacq15<br>
              srel2</tt></td>
          <td>register</td>
          <td>Semaphore access, read only. Depending on the name an <u>acq</u>uire
            or <u>rel</u>ease instruction is issued.<br>
            <i>This syntax is only provided for compatibility with Broadcom
              source codes. Normally you should prefer the <tt>sacq</tt> and <tt>srel</tt>
              instructions.</i></td>
        </tr>
        <tr>
          <td>label</td>
          <td><tt>:loop</tt></td>
          <td>label</td>
          <td>label receiving the absolute number of bytes from the start of the
            assembly.</td>
        </tr>
        <tr>
          <td>internal raw register</td>
          <td><tt>:[0,1,0,3]</tt></td>
          <td>register</td>
          <td>Internal register constant. It consists of the fields register <i>number,
              register type, vector rotation</i> and <i>pack/unpack mode</i>.
            The latter two are optional and by default zero. <em>This syntax is
              for internal use only and subject to change.</em></td>
        </tr>
      </tbody>
    </table>
    <h3> <a id="register" name="register"></a>Hardware register</h3>
    <table border="1" cellpadding="3" cellspacing="0">
      <thead>
        <tr>
          <th colspan="1" rowspan="2">Number</th>
          <th style="text-align: center;" colspan="2" rowspan="1">read<nobr></nobr></th>
          <th style="text-align: center;" colspan="2" rowspan="1">write</th>
        </tr>
        <tr>
          <th style="text-align: center;">file A</th>
          <th style="text-align: center;">file B</th>
          <th style="text-align: center;">file A</th>
          <th style="text-align: center;">file B</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>32</td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>unif</tt></td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>r0</tt> </td>
        </tr>
        <tr>
          <td>33</td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>r1</tt> </td>
        </tr>
        <tr>
          <td>34<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>r2</tt> </td>
        </tr>
        <tr>
          <td>35<br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>vary</tt>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>r3</tt> </td>
        </tr>
        <tr>
          <td>36<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>tmurs</tt>
          </td>
        </tr>
        <tr>
          <td>37<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"><tt>r5quad</tt> </td>
          <td style="text-align: center;"><tt>r5rep</tt> </td>
        </tr>
        <tr>
          <td>38<br>
          </td>
          <td style="text-align: center;"><tt>elem_num</tt> </td>
          <td style="text-align: center;"><tt>qpu_num</tt> </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>irq<br>
              interrupt</tt> </td>
        </tr>
        <tr>
          <td>39<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
        </tr>
        <tr>
          <td>40<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"><tt>unif_addr</tt> </td>
          <td style="text-align: center;"><tt>unif_addr_rel</tt> </td>
        </tr>
        <tr>
          <td>41<br>
          </td>
          <td style="text-align: center;"><tt>x_coord</tt> </td>
          <td style="text-align: center;"><tt>y_coord</tt> </td>
          <td style="text-align: center;"><tt>x_coord</tt> </td>
          <td style="text-align: center;"><tt>y_coord</tt> </td>
        </tr>
        <tr>
          <td>42<br>
          </td>
          <td style="text-align: center;"><tt>ms_mask</tt> </td>
          <td style="text-align: center;"><tt>rev_flag</tt> </td>
          <td style="text-align: center;"><tt>ms_mask</tt> </td>
          <td style="text-align: center;"><tt>rev_flag</tt> </td>
        </tr>
        <tr>
          <td>43<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>stencil</tt></td>
        </tr>
        <tr>
          <td>44<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>tlbz</tt></td>
        </tr>
        <tr>
          <td>45<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>tlbm</tt></td>
        </tr>
        <tr>
          <td>46<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>tlbc</tt></td>
        </tr>
        <tr>
          <td>47<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>tlbam</tt></td>
        </tr>
        <tr>
          <td>48<br>
          </td>
          <td style="text-align: center;" colspan="4" rowspan="1"><tt>vpm</tt></td>
        </tr>
        <tr>
          <td>49<br>
          </td>
          <td style="text-align: center;"><tt>vr_busy</tt> </td>
          <td style="text-align: center;"><tt>vw_busy</tt> </td>
          <td style="text-align: center;"><tt>vr_setup</tt> </td>
          <td style="text-align: center;"><tt>vw_setup</tt> </td>
        </tr>
        <tr>
          <td>50<br>
          </td>
          <td style="text-align: center;"><tt>vr_wait</tt> </td>
          <td style="text-align: center;"><tt>vw_wait</tt> </td>
          <td style="text-align: center;"><tt>vr_addr</tt> </td>
          <td style="text-align: center;"><tt>vw_addr</tt> </td>
        </tr>
        <tr>
          <td>51<br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>mutex<br>
              mutex_acq</tt></td>
          <td style="text-align: center;" rowspan="1" colspan="2"><tt>mutex<br>
              mutex_rel</tt></td>
        </tr>
        <tr>
          <td>52<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>recip</tt></td>
        </tr>
        <tr>
          <td>53<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>recipsqrt</tt></td>
        </tr>
        <tr>
          <td>54<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>exp</tt></td>
        </tr>
        <tr>
          <td>55<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>log</tt></td>
        </tr>
        <tr>
          <td>56<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>t0s</tt></td>
        </tr>
        <tr>
          <td>57<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>t0t</tt></td>
        </tr>
        <tr>
          <td>58<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>t0r</tt></td>
        </tr>
        <tr>
          <td>59<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>t0b</tt></td>
        </tr>
        <tr>
          <td>60<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>t1s</tt></td>
        </tr>
        <tr>
          <td>61<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>t1t</tt></td>
        </tr>
        <tr>
          <td>62<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2" rowspan="1"><tt>t1r</tt></td>
        </tr>
        <tr>
          <td>63<br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;"> <br>
          </td>
          <td style="text-align: center;" colspan="2"><tt>t1b</tt></td>
        </tr>
      </tbody>
    </table>
    <h2><a name="operator"></a>Operators and precedence</h2>
    <p>The operators share mainly the same precedence as for the C language.</p>
    <table border="1" cellpadding="3" cellspacing="0">
      <thead>
        <tr>
          <th>Precedence</th>
          <th>Type</th>
          <th>Operator</th>
          <th><nobr>Operand types</nobr></th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>brace</td>
          <td><tt>( )</tt></td>
          <td>all<br>
          </td>
          <td><br>
          </td>
        </tr>
        <tr>
          <td colspan="1" rowspan="27">2<br>
            <br>
            <br>
          </td>
          <td colspan="1" rowspan="4">unary</td>
          <td><tt>+</tt> </td>
          <td>all<br>
          </td>
          <td>identity operation<br>
          </td>
        </tr>
        <tr>
          <td><tt>-</tt></td>
          <td>int &rarr; int<br>
            float &rarr; float<br>
          </td>
          <td>negative value</td>
        </tr>
        <tr>
          <td><tt>~</tt></td>
          <td>int &rarr; int<br>
          </td>
          <td>binary not</td>
        </tr>
        <tr>
          <td><tt>!</tt></td>
          <td>int &rarr; int</td>
          <td>logical not, <tt>1</tt> if operand is zero, otherwise <tt>0</tt></td>
        </tr>
        <tr>
          <td colspan="1" rowspan="3">unary<br>
            math</td>
          <td><tt>abs</tt></td>
          <td>int &rarr; int<br>
            float &rarr; float</td>
          <td>absolute value |x|</td>
        </tr>
        <tr>
          <td><tt>ceil</tt></td>
          <td colspan="1" rowspan="2">float &rarr; int</td>
          <td>smallest integer not less than value</td>
        </tr>
        <tr>
          <td><tt>floor</tt></td>
          <td>largest integer not greater than value</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="6">unary<br>
            exponential</td>
          <td><tt>exp</tt></td>
          <td colspan="1" rowspan="6">int &rarr; float<br>
            float &rarr; float</td>
          <td>natural exponential function</td>
        </tr>
        <tr>
          <td><tt>exp2</tt></td>
          <td>binary exponential function</td>
        </tr>
        <tr>
          <td><tt>exp10</tt></td>
          <td>common exponential function</td>
        </tr>
        <tr>
          <td><tt>log</tt></td>
          <td>natural logarithm</td>
        </tr>
        <tr>
          <td><tt>log2</tt></td>
          <td>binary logarithm</td>
        </tr>
        <tr>
          <td><tt>log10</tt></td>
          <td>common logarithm</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="6">unary<br>
            trigonometric</td>
          <td><tt>cos</tt></td>
          <td colspan="1" rowspan="6">int &rarr; float<br>
            float &rarr; float</td>
          <td>cosine</td>
        </tr>
        <tr>
          <td><tt>sin</tt></td>
          <td>sine</td>
        </tr>
        <tr>
          <td><tt>tan</tt></td>
          <td>tangent</td>
        </tr>
        <tr>
          <td><tt>acos</tt></td>
          <td>arc cosine</td>
        </tr>
        <tr>
          <td><tt>asin</tt></td>
          <td>arc sine</td>
        </tr>
        <tr>
          <td><tt>atan</tt></td>
          <td>arc tangent</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="6">unary<br>
            hyperbolic</td>
          <td><tt>cosh</tt></td>
          <td colspan="1" rowspan="6">int &rarr; float<br>
            float &rarr; float</td>
          <td>hyperbolic cosine</td>
        </tr>
        <tr>
          <td><tt>sinh</tt></td>
          <td>hyperbolic sine</td>
        </tr>
        <tr>
          <td><tt>tanh</tt></td>
          <td>hyperbolic tangent</td>
        </tr>
        <tr>
          <td><tt>acosh</tt></td>
          <td>arc hyperbolic cosine</td>
        </tr>
        <tr>
          <td><tt>asinh</tt></td>
          <td>arc hyperbolic sine</td>
        </tr>
        <tr>
          <td><tt>atanh</tt></td>
          <td>arc hyperbolic tangent</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="2">unary<br>
            extended<br>
            math</td>
          <td><tt>erf</tt></td>
          <td colspan="1" rowspan="2">int &rarr; float<br>
            float &rarr; float</td>
          <td>error function</td>
        </tr>
        <tr>
          <td><tt>erfc</tt></td>
          <td>complementary error function</td>
        </tr>
        <tr>
          <td>3<br>
          </td>
          <td>binary<br>
            power<br>
          </td>
          <td><tt>**</tt></td>
          <td colspan="1" rowspan="4">int, int &rarr; int<br>
            float, float &rarr; float <br>
            int, float &rarr; float<br>
            float, int &rarr; float</td>
          <td>power, x<small><sup>y</sup></small><br>
          </td>
        </tr>
        <tr>
          <td colspan="1" rowspan="3">4<br>
            <br>
            <br>
          </td>
          <td colspan="1" rowspan="3">binary<br>
            multiplicative</td>
          <td><tt>*</tt></td>
          <td>multiplication<br>
          </td>
        </tr>
        <tr>
          <td><tt>/</tt></td>
          <td>division</td>
        </tr>
        <tr>
          <td><tt>%</tt></td>
          <td>modulus</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="2">5<br>
          </td>
          <td colspan="1" rowspan="2">binary<br>
            additive</td>
          <td><tt>+</tt></td>
          <td colspan="1" rowspan="2">int, int &rarr; int<br>
            float, float &rarr; float<br>
            int, float &rarr; float<br>
            float, int &rarr; float<br>
            reg, int &rarr; reg</td>
          <td>addition<br>
            In case the left operand is a register the register number changes.
            The resulting number must not exceed the range for the given
            register type. The operation never changes the type of a register.</td>
        </tr>
        <tr>
          <td><tt>-</tt></td>
          <td>subtraction<br>
            In case the left operand is a register the register number changes.
            The resulting number must not exceed the range for the given
            register type. The operation never changes the type of a register.</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="8">6 </td>
          <td colspan="1" rowspan="4">binary<br>
            bit shift</td>
          <td><tt>&lt;&lt; </tt></td>
          <td colspan="1" rowspan="2">int, int &rarr; int<br>
            float, int &rarr; float<br>
            reg, int &rarr; reg<br>
            reg, reg &rarr; reg</td>
          <td>arithmetic shift left (signed)<br>
            Arithmetic shift left is basically the same than logical shift left
            unless the right operand is negative where the shift direction turns
            to right.<br>
            If the left operand is float, only the exponent is shifted, i.e. the
            number is multiplied by the power of two indicated by the right
            operand.<br>
            If the left operand is a register, the rotate unit of the MUL ALU is
            activated by small immediate values &ge; 48. The right operand need
            to be an integer constant or register <tt>r5</tt>.</td>
        </tr>
        <tr>
          <td><tt>&gt;&gt; </tt></td>
          <td>arithmetic shift right (signed)<br>
            If the left operand is float, only the exponent is shifted, i.e. the
            number is multiplied by the power of two indicated by the right
            operand.<br>
            If the left operand is a register, the rotate unit of the MUL ALU is
            activated by small immediate values &ge; 48. The right operand need
            to be an integer constant or register <tt>r5</tt>.</td>
        </tr>
        <tr>
          <td><tt>&lt;&lt;&lt;</tt></td>
          <td colspan="1" rowspan="2">int, int &rarr; int</td>
          <td>logical shift left (unsigned shifted by signed)<br>
            Logical shift left is basically the same than arithmetic shift left
            unless the right operand is negative where the shift direction turns
            to right.</td>
        </tr>
        <tr>
          <td><tt>&gt;&gt;&gt;</tt></td>
          <td>logical shift right (unsigned shifted by signed)</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="4">binary<br>
            rotate</td>
          <td><tt>&gt;&lt;&lt;</tt></td>
          <td colspan="1" rowspan="4">int, int &rarr; int</td>
          <td>32 bit rotate left</td>
        </tr>
        <tr>
          <td><tt>&gt;&gt;&lt;</tt></td>
          <td>32 bit rotate right</td>
        </tr>
        <tr>
          <td><tt>&gt;&lt;&lt;&lt;</tt></td>
          <td>64 bit rotate left</td>
        </tr>
        <tr>
          <td><tt>&gt;&gt;&gt;&lt;</tt></td>
          <td>64 bit rotate right</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="5">7</td>
          <td colspan="1" rowspan="5">binary<br>
            relational</td>
          <td><tt>&gt;</tt></td>
          <td colspan="1" rowspan="5">all, all &rarr; int</td>
          <td>greater than</td>
        </tr>
        <tr>
          <td><tt>&gt;=</tt></td>
          <td>greater than or equal</td>
        </tr>
        <tr>
          <td><tt>&lt;</tt> </td>
          <td>less than</td>
        </tr>
        <tr>
          <td><tt>&lt;=</tt> </td>
          <td>less than or equal</td>
        </tr>
        <tr>
          <td><tt>&lt;=&gt;</tt></td>
          <td>full comparison, evaluates to <tt>-1</tt> if less than, <tt>+1</tt>
            if greater, <tt>0</tt> if equal and <tt>-0x80000000</tt> if
            indeterminate</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="4">8<br>
          </td>
          <td colspan="1" rowspan="4">binary<br>
            equality</td>
          <td><tt>==</tt> </td>
          <td colspan="1" rowspan="4">all, all &rarr; int</td>
          <td>equal</td>
        </tr>
        <tr>
          <td><tt>!=</tt> </td>
          <td>not equal</td>
        </tr>
        <tr>
          <td><tt>===</tt></td>
          <td>identical, not just equal, e.g. <tt>NaN === NaN</tt> but <tt>NaN
              != NaN</tt></td>
        </tr>
        <tr>
          <td><tt>!==</tt></td>
          <td>not identical, e.g. <tt>1.0 !== 1</tt> but <tt>1.0 == 1</tt> and
            also <tt>1.00 === 1.0</tt></td>
        </tr>
        <tr>
          <td>9</td>
          <td colspan="1" rowspan="4">binary<br>
            bitwise</td>
          <td><tt>&amp;</tt></td>
          <td colspan="1" rowspan="4">int, int &rarr; int</td>
          <td>binary and</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="2">10</td>
          <td><tt>^</tt></td>
          <td>binary exclusive or</td>
        </tr>
        <tr>
          <td><tt>!^</tt></td>
          <td>binary exclusive nor</td>
        </tr>
        <tr>
          <td>11</td>
          <td><tt>|</tt></td>
          <td>binary inclusive or</td>
        </tr>
        <tr>
          <td>12</td>
          <td colspan="1" rowspan="4">binary<br>
            logical</td>
          <td><tt>&amp;&amp;</tt></td>
          <td colspan="1" rowspan="4">int, int &rarr; int</td>
          <td>logical and</td>
        </tr>
        <tr>
          <td colspan="1" rowspan="2">13</td>
          <td><tt>^^</tt></td>
          <td>logical exclusive or</td>
        </tr>
        <tr>
          <td><tt>!^^</tt></td>
          <td>logical exclusive nor</td>
        </tr>
        <tr>
          <td>14</td>
          <td><tt>||</tt></td>
          <td>logical inclusive or</td>
        </tr>
      </tbody>
    </table>
    <h3>Relational operators and different operand types</h3>
    <p>If the left and right hand side of a relational or equality operator has
      a different data type, e.g. register vs. integer the following sequence
      applies. Types with higher ordinals below always compare greater.</p>
    <ol>
      <li><b>Integer or floating point constant</b><br>
        Integer comparison is always signed.<br>
        If integer is compared against a float then the integer operand
        propagates to float before the comparison. Note that this can cause a
        loss of precision.</li>
      <li><b>Load immediate per element constant</b><br>
        Do not rely on comparison order of two LDIPES constants.</li>
      <li><b>Register</b><br>
        Comparing two registers is only reliable if both registers are exactly
        of the same type. Even equality comparison might give unexpected
        results. E.g. <tt>unif == ra32</tt> evaluates to false because <tt>ra32</tt>
        is pinned to register file A while <tt>unif</tt> is not.</li>
      <li><b>Semaphore register</b><br>
        Acquire is greater than release.<b> </b></li>
      <li><b>Label</b><br>
        You can safely compare two labels.<b> </b></li>
    </ol>
    <h3> Register operands</h3>
    <p>Some operators can be applied to registers rather than constants. This
      operators will <em>not modify the value at runtime</em>, instead they
      have a special meaning at compile time.</p>
    <dl>
      <dt><tt>+ -</tt></dt>
      <dd>Addition and subtraction to a register modifies the <em>register
          number</em>. You must not exceed the domain of the specific register
        type, of course.</dd>
      <dt><tt>&lt;&lt; &gt;&gt;</tt></dt>
      <dd>Shift operators on registers activate the vector rotation of the MUL
        ALU to pass the result to another SIMD slice. <tt>&lt;&lt;</tt> rotates
        to higher QPU element number, <tt>&gt;&gt;</tt> to lower elements. Note
        that the rotation direction is inverted when applied to a source
        argument, i.e. like if you <em>take</em> the value from a higher or
        lower element number.</dd>
    </dl>
    <h4>Alphanumeric operators</h4>
    <p>Note that <tt>vc4asm</tt> treats mathematical functions like <tt>log</tt>
      as unary operators rather than functions. I.e. the basic syntax is <tt>log
        7</tt> rather than <tt>log(7)</tt>. However, since braces are always
      allowed around expression the latter will work as well although the braces
      are no function call operator.</p>
    <dl>
    </dl>
  </body>
</html>
